package com.octopus.yangj.customized.scope;

import java.util.Arrays;
import java.util.List;

import com.octopus.kernal.controller.SearchOperator;
import com.octopus.kernal.service.BusinessScopeInterface;
import com.octopus.yangj.generated.controller.SearchEventCategoryCommand;
import com.octopus.yangj.generated.model.EventCategoryStruct;
import com.octopus.yangj.generated.service.EventCategoryService;
import com.octopus.yangj.util.EventCategoryLevel;
import com.octopus.yangj.util.ServiceFactory;

public class EventCategoryThirdLevelSelectScope implements BusinessScopeInterface{

	@Override
	public List<Object> getScope() {
		EventCategoryService eventCategoryService = ServiceFactory.getEventCategoryService();
		SearchEventCategoryCommand searchCommand = new SearchEventCategoryCommand();
		searchCommand.setOffset(null);
		searchCommand.setEntity(new EventCategoryStruct());
		searchCommand.setOperator(new EventCategoryStruct());
		searchCommand.getEntity().setLevel(EventCategoryLevel.THIRD.getLevel());
		searchCommand.getOperator().setLevel(Integer.valueOf(SearchOperator.EQUAL.ordinal()));
		List<EventCategoryStruct> list = eventCategoryService.search(searchCommand);
		return Arrays.asList(list.toArray());
	}

}
